<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .box{
      width: 300px;
      height: 200px;
      position:fixed;
      right: 0;
      /* border: 1px solid red; */
      top:50%;
    }
    .code{
      width: 52px;
      height: 52px;
      display: block;
      background: url("images/bgs.png") -159px -50px no-repeat;
      position: absolute;
      right: 0;
    }
    .hide_code{
      width: 149px;
      height: 152px;
      display: block;
      background: url("images/456.png") no-repeat;
      position: absolute;
      right: 55px;
      top: -52px;
    }
  </style>

</head>
<body>
  <div class="box">
    <a href="#" class="code"></a>
    <span class="hide_code" style="display:none;"></span>
  </div>
  
  <script>
    var a_btn = document.querySelector('a');
    var span = document.querySelector('span');
    a_btn.onmouseenter = function(){
      span.style.display = 'block'; 
    }
    a_btn.onmouseleave = function(){
      span.style.display = 'none';
    }
  </script>
</body>
</html>